<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<%@ include file="/pub/head_latest.inc"%>
    	<title></title>
	</head>
	<body>
 		 <form id="form" action="${baseURL}/report/simplereportexport/export.do">
 		 	 <input name="csId" value="${csId}" id="csId"/>
 		 	 <input name="exportType"  id="exportType"/>
   		 </form>
		 <script>	
		 	function beforeExport(json){
		 		$("#form").empty();
		 		$("<input name='csId' value='${csId}' id='csId'/>").appendTo($("#form"));
		 		$("<input name='exportType' value='0' id='exportType'/>").appendTo($("#form"));
		 		
		 		var inputStr0 = "<input name='";
		 		var inputStr1 = "' value='";
		 		var inputStr2 = "'/>";
 		 		for(var key in json){
					$(inputStr0+key+inputStr1+json[key]+inputStr2).appendTo($("#form"));
		 		}
 		 	}
		 	
 			function FF_Print(json){
 				
 				var tempForm = document.createElement("form");
 		    	tempForm.target = "pdfWindow";
 		    	tempForm.id="tempForm1";  
 		    	tempForm.method="post";
 		    	tempForm.action="${baseURL}/report/simplereportexport/print.do";
 		    	
 		    	var hideInput = document.createElement("input");
 		    	hideInput.type="hidden";
 		    	hideInput.name= "csId";
 		    	hideInput.value= '${csId}';
 		    	tempForm.appendChild(hideInput);
 		    	
 		    	var hideInput1 = document.createElement("input");
 		    	hideInput1.type="hidden";
 		    	hideInput1.name= "exportType";
 		    	hideInput1.value= '0';
 		    	tempForm.appendChild(hideInput1);
 		    	
 		    	var inputStr0 = "<input name='";
		 		var inputStr1 = "' value='";
		 		var inputStr2 = "'/>";
 		 		for(var key in json){
					$(tempForm).append(inputStr0+key+inputStr1+json[key]+inputStr2);
		 		}
 		 		
 		    	document.body.appendChild(tempForm);
 		    	
 		    	window.open('about:blank', 'pdfWindow');
 		    	tempForm.submit();
 		    	document.body.removeChild(tempForm);
 			}
			
			function FF_ExportExcel(json){
				beforeExport(json);
				$("#exportType").val(2);
				$("#form").submit();
 			}
			
			function FF_ExportDoc(json){
  				beforeExport(json);
				$("#exportType").val(1);
				$("#form").submit(); 
 			}
			
			function FF_ExportPDF(json){
				beforeExport(json);
				$("#exportType").val(3);
				$("#form").submit();
 			}
		</script>
	</body>
</html>
